-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix single non zeroth index resolving #5
Open
cam-mh
wants to merge
1
commit into
fellowapp:main
Choose a base branch
from
cam-mh:fix-single-non-zeroth-index-resolving
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix single non zeroth index resolving #5
cam-mh
wants to merge
1
commit into
fellowapp:main
from
cam-mh:fix-single-non-zeroth-index-resolving
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tony
reviewed
Aug 4, 2024
@@ -460,7 +460,7 @@ def on_one_resolved(result): | |||
|
|||
# If there is only one index, avoid the overhead of parallelization. | |||
index = awaitable_indices[0] | |||
return completed_results[0].then(on_one_resolved) | |||
return completed_results[index].then(on_one_resolved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fellowapp @sciyoshi This fixed an issue for me.
Traceback
╭────────────────────────── Traceback (most recent call last) ───────────────────────────╮ │
│ promise.py:213 in execute_field │
│ │
│ 210 │ │ │ │ │
│ 211 │ │ │ │ return await_result() │
│ 212 │ │ │ │
│ ❱ 213 │ │ │ completed = self.complete_value( │
│ 214 │ │ │ │ return_type, field_nodes, info, path, result │
│ 215 │ │ │ ) │
│ 216 │ │ │ if self.is_promise(completed): │
│ │
│ site-packages/graphql/execution/execute.py:612 in complete_value │
│ │
│ 609 │ │ # If field type is NonNull, complete for inner type, and throw field er │
│ 610 │ │ # result is null. │
│ 611 │ │ if is_non_null_type(return_type): │
│ ❱ 612 │ │ │ completed = self.complete_value( │
│ 613 │ │ │ │ cast(GraphQLNonNull, return_type).of_type, │
│ 614 │ │ │ │ field_nodes, │
│ 615 │ │ │ │ info, │
│ │
│ site-packages/graphql/execution/execute.py:632 in complete_value │
│ │
│ 629 │ │ │
│ 630 │ │ # If field type is List, complete each item in the list with inner type │
│ 631 │ │ if is_list_type(return_type): │
│ ❱ 632 │ │ │ return self.complete_list_value( │
│ 633 │ │ │ │ cast(GraphQLList, return_type), field_nodes, info, path, result │
│ 634 │ │ │ ) │
│ 635 │
│ │
│ promise.py:484 in complete_list_value │
│ │
│ 481 │ │ │ │ completed_results[index] for index in awaitable_indices │
│ 482 │ │ │ ]).then(on_all_resolve) │
│ 483 │ │ │
│ ❱ 484 │ │ res = get_completed_results() │
│ 485 │ │ return res │
│ 486 │
│ │
│ promise.py:473 in get_completed_results │
│ │
│ 470 │ │ │ │ │
│ 471 │ │ │ │ # If there is only one index, avoid the overhead of parallelizat │
│ 472 │ │ │ │ index = awaitable_indices[0] │
│ ❱ 473 │ │ │ │ return completed_results[0].then(on_one_resolved) │
│ 474 │ │ │ │
│ 475 │ │ │ def on_all_resolve(results): │
│ 476 │ │ │ │ for index, result in zip(awaitable_indices, results, strict=Fals │
╰────────────────────────────────────────────────────────────────────────────────────────╯
Unfortunately, due to the complexity of the schemas I am working with, I don't have an MVP for a test or recreation. If there's a critical need for it please ping me.
I'm having the same issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a bug on this line. I believe it should be
return completed_results[index].then(on_one_resolved)
instead ofreturn completed_results[0].then(on_one_resolved)
It looks like that code is optimizing for when there is only a single Promise being returned and tries to execute the 0th index of "awaitable_promise"s. However it is possible the awaitable index may not be the 0ths index, it could be the 1st.
Here is some sample code that reproduces the issue.
Before:
After: